#include <iostream>
#include <cmath>

using namespace std;

typedef long long LL;

const int N = 1e4 + 10;
LL a[N], b[N];

int n;

int main()
{
	double r = 1e10, l = 0;
	cin >> n;
	for(int i = 1; i <= n; i++) 
	{
		cin >> a[i] >> b[i];
		r = min(1.0 * a[i] / b[i], r);
		l = max(1.0 * a[i] / (b[i] + 1), l);
	}
	cout << ceil(l) << " " << floor(r);
	return 0;
}
